﻿using System;
using System.Collections.Generic;

namespace ProblemsSet
{
    public class Problem_5: BaseProblem
    {
        public override object GetResult()
        {
            var res = new Dictionary<long, long>();
            for (var i= 2; i <= 20; i++)
            {
                foreach (var pair in MathLogic.GetPrimeFactors(i))
                {
                    if (res.ContainsKey(pair.Key))
                    {
                        res[pair.Key] = Math.Max(pair.Value, res[pair.Key]);
                    }else
                    {
                        res.Add(pair.Key, pair.Value);
                    }
                }
            }
            return MathLogic.GetMiltipleInt(res);
        }

        public override string Problem
        {
            get
            {
                return @"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?";
            }
        }

        public override bool IsSolved
        {
            get
            {
                return true;
            }
        }

        public override object Answer
        {
            get
            {
                return 232792560;
            }
        }
    }
}
